<?php
class story{
	function selectStory()
	{
		global $con;
		$sql="select * from tbl_course";
		$res = mysqli_query($con,$sql);
		return $res;
	}/// EOF
	function selectedStory()
	{
		global $con;
		$sql="select * from tbl_course WHERE course_status='1'";
		$res = mysqli_query($con,$sql);
		return $res;
	}/// EOF
	
	function addStory($cors_title,$cors_short_des,$cors_details,$status,$cors_add_date,$cors_image)
	{
		global $con;
		$sql="INSERT INTO tbl_course SET 
			course_title='$cors_title', 
			course_short_des='$cors_short_des',
			course_details='$cors_details',
			course_status='$status', 
			course_added_date='$cors_add_date', 
			course_image='$cors_image'";
		mysqli_query($con,$sql);
	}/// EOF
	function deleteStory($id)
	{
		global $con;
		$sql="DELETE FROM tbl_course WHERE course_id='$id' ";
		mysqli_query($con,$sql);
		}
	function editStory($corsId,$cors_title,$cors_short_des,$cors_details,$status,$cors_add_date,$cors_image)
	{
		global $con;
		echo $sql="UPDATE tbl_course SET 
			course_title='$cors_title',
			course_short_des='$cors_short_des', 
			course_details='$cors_details',
			course_status='$status',
			course_added_date='$cors_add_date', 
			course_image='$cors_image' 
			WHERE 
			course_id='$corsId'";
		mysqli_query($con,$sql);
	}	
	function getStoryById($id)
	{
		global $con;
		$sql="SELECT *FROM tbl_course WHERE course_id='$id'";
		$res=mysqli_query($con,$sql);
		return $res;	
	}
	function storyStatus($status,$Id){
		global $con;
		$sql="UPDATE tbl_course SET course_status='$status' WHERE course_id='$Id'";
		mysqli_query($con,$sql);
	}
	
}//EOC


$objCourse=new story();
?>
